package com.galen.controller;

import java.util.Arrays;

/**
 * Created by 16978 on 2017/3/1.
 */
public class TestLSDSuanFa {
    public static void main(String[] args) {

        String a[] = new String[]{"4PGC938","2IYE230","3CI0720","1ICK750","1OHV845"};
        int w = 7;
        int n = a.length;
        int r = 256;
        String aux [] = new String[n];

        char q = '8';
        int p = 1;
        System.out.println(q+p);

        System.out.println();

        for (int d = w-1; d >=0 ; d--) {

            int count [] = new int[r+1];

            for (int i = 0; i < n; i++) {
                count[a[i].charAt(d) + 1]++;
            }

            System.out.println(Arrays.toString(count));
            for (int i = 0; i < r; i++) {
                count[i + 1] += count[i];
            }
            System.out.println(Arrays.toString(count));


            for (int i = 0; i < n; i++) {
                aux[count[a[i].charAt(d)]++] = a[i];
            }

            for (int i = 0; i < n; i++) {
                a[i] = aux[i];
                System.out.println(a[i]);
            }

        }
    }
}
